home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
manchester
/
2.3
/
enhanced-condense-changes.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
3KB
|
84 lines
" NAME enhanced-condense-changes
AUTHOR neild@cs.man.ac.uk
FUNCTION can now rebuild image after condense
ST-VERSIONS 2.3
PREREQUISITES
CONFLICTS
DISTRIBUTION world
VERSION 1.1
DATE 22 Jan 1989
SUMMARY enhanced-condense-changes
(2.3) neild
The standard method of condensing the changes file loses all
changes to class definitions and all new class definitions. This
means an image cannot be rebuilt from a condensed changes file. The
changes here cause class definitions to be placed on the condensed
changes file as changes (in super class order). Its slower because
the changes file has to be scanned, but then how often do you
condense your changes files.
"!
'From Smalltalk-80, Version 2.2 of July 4, 1987 on 4 September 1989 at 6:08:31 pm'!
'The standard method of condensing the changes file loses all changes to class
definitions and all new class definitions. This means an image cannot be rebuilt
>from condensed changes file. the two changes here cause class definitions to be placed
on the condensed changes file as changes (in super class order).'!
!ClassRelatedChange methodsFor: 'accessing'!
nonMetaclassName
^((ReadStream on: className) upTo: Character space) asSymbol! !
!ChangeScanner class methodsFor: 'scanning changes files'!
classesWithChangedDefinitions
| changedClasses changesFile className |
"Answer the set of classes whose definitions (or metaclass definitions) have been
changed, i.e. the classes of ClassDefinitionChanges etc on the changes file."
"ChangeScanner classesWithChangedDefinitions."
changedClasses _ IdentitySet new.
SourceFiles isNil ifTrue: [ ^changedClasses ].
(changesFile _ SourceFiles at: 2) reset; readOnly.
Transcript show: 'searching for changed class definitions ...'.
self new scanFile: changesFile do: [ :aChange |
(aChange class == ClassDefinitionChange
or: [ aChange class == ClassOtherChange and: [ 'inst vars for' = aChange type ] ])
ifTrue: [
className _ aChange nonMetaclassName.
(Smalltalk classNames includes: className) ifTrue: [
changedClasses add: (Smalltalk at: className) ] ] ].
Transcript show: ' done'; cr.
changesFile setToEnd.
^changedClasses! !
!SystemDictionary methodsFor: 'system compression'!
condenseChanges
"Move all the changes onto a compacted sources file ensuring that class
definitions appear before all other changes to a class.
Smalltalk condenseChanges."
| f fileName changedDefinitions |
f _ FileStream fileNamed: 'temp.changes'.
f timeStamp.
Cursor wait showWhile: [
changedDefinitions _ ChangeSet superclassOrder: ChangeScanner
classesWithChangedDefinitions ].
changedDefinitions do: [ :aClass |
f nextChunkPut: aClass definition; cr; nextChunkPut: aClass class definition; cr; cr ].
Smalltalk allClassesDo: [:class |
class moveChangesTo: f.
class class moveChangesTo: f].
f close.
f readOnly.
fileName _ (SourceFiles at: 2) name.
(SourceFiles at: 2) close.
SourceFiles at: 2 put: f.
FileDirectory removeKey: fileName.
f file rename: fileName! !